package cn.tedu.spring.bean;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;

@Repository
public class UserDao {
    /*
        依赖注入DI
        @Value注解:只能注入简单的数据类型[字符串,数值的基本类型]
        添加位置: 可以添加在类属性上,也可以添加在set方法上
     */
    @Value("jdbc:mysql://localhost:3306/tedu")
    private String dbUrl;
    @Value("root")
    private String username;
    @Value("root")
    private String password;

    public String getDbUrl() {
        return dbUrl;
    }

    public void setDbUrl(String dbUrl) {
        this.dbUrl = dbUrl;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }
   // @Value("123456")
    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String toString() {
        return "UserDao{" +
                "dbUrl='" + dbUrl + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                '}';
    }
}
